package com.tbit.uqbike.object.pojo.vo;

import com.tbit.uqbike.object.pojo.ParamDate;
import com.tbit.uqbike.webmanager.util.csv.annotations.Csv;
import com.tbit.uqbike.webmanager.util.csv.annotations.Sum;

import java.math.BigDecimal;
import java.util.Optional;

/**
 * 用户押金收支vo
 *
 * @Author:yanlun
 * @DATE: 2022/11/18
 */
public class AccountDayStatDepositDetailVO extends ParamDate {

    private Integer accountId;
    /**
     * 区域
     */
    @Csv(name = "区域")
    private String accountName;
    /**
     * 日期
     */
    @Csv(name = "日期")
    private String date;
    /**
     * 收入
     */
    @Sum
    @Csv(name = "收入")
    private BigDecimal income;
    /**
     * 收入笔数
     */
    @Sum
    @Csv(name = "收入笔数")
    private Long incomeCount;

    /**
     * 人工押金充值收入
     */
    @Sum
    @Csv(name = "人工押金充值收入")
    private BigDecimal manualDepositIncomeSum;
    /**
     * 人工押金充值收入笔数
     */
    @Sum
    @Csv(name = "人工押金充值收入笔数")
    private Long manualDepositIncomeCount;
    /**
     * 人工押金充值支出
     */
    @Sum
    @Csv(name = "人工押金充值支出")
    private BigDecimal manualDepositExpenditureSum;
    /**
     * 人工押金充值支出笔数
     */
    @Sum
    @Csv(name = "人工押金充值支出笔数")
    private Long manualDepositExpenditureCount;
    /**
     * 退款
     */
    @Sum
    @Csv(name = "退款")
    private BigDecimal refund;
    /**
     * 退款笔数
     */
    @Sum
    @Csv(name = "退款笔数")
    private Long refundCount;
    /**
     * 期初
     */
    @Csv(name = "期初")
    private BigDecimal termStart;
    /**
     * 期末
     */
    @Csv(name = "期末")
    private BigDecimal termEnd;

    public AccountDayStatDepositDetailVO() {
        fillData();
    }

    public Integer getAccountId() {
        return accountId;
    }

    public void setAccountId(Integer accountId) {
        this.accountId = accountId;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public BigDecimal getIncome() {
        return income == null ? null : income.setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public void setIncome(BigDecimal income) {
        this.income = income;
    }

    public Long getIncomeCount() {
        return incomeCount;
    }

    public void setIncomeCount(Long incomeCount) {
        this.incomeCount = incomeCount;
    }

    public BigDecimal getRefund() {
        return refund == null ? null : refund.setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public void setRefund(BigDecimal refund) {
        this.refund = refund;
    }


    public BigDecimal getManualDepositIncomeSum() {
        return manualDepositIncomeSum == null ? null : manualDepositIncomeSum.setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public void setManualDepositIncomeSum(BigDecimal manualDepositIncomeSum) {
        this.manualDepositIncomeSum = manualDepositIncomeSum;
    }

    public Long getManualDepositIncomeCount() {
        return manualDepositIncomeCount;
    }

    public void setManualDepositIncomeCount(Long manualDepositIncomeCount) {
        this.manualDepositIncomeCount = manualDepositIncomeCount;
    }

    public BigDecimal getManualDepositExpenditureSum() {
        return manualDepositExpenditureSum == null ? null : manualDepositExpenditureSum.setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public void setManualDepositExpenditureSum(BigDecimal manualDepositExpenditureSum) {
        this.manualDepositExpenditureSum = manualDepositExpenditureSum;
    }

    public Long getManualDepositExpenditureCount() {
        return manualDepositExpenditureCount;
    }

    public void setManualDepositExpenditureCount(Long manualDepositExpenditureCount) {
        this.manualDepositExpenditureCount = manualDepositExpenditureCount;
    }

    public Long getRefundCount() {
        return refundCount;
    }

    public void setRefundCount(Long refundCount) {
        this.refundCount = refundCount;
    }

    public BigDecimal getTermStart() {
        return termStart == null ? null : termStart.setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public void setTermStart(BigDecimal termStart) {
        this.termStart = termStart;
    }

    public BigDecimal getTermEnd() {
        return termEnd == null ? null : termEnd.setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public void setTermEnd(BigDecimal termEnd) {
        this.termEnd = termEnd;
    }

    public void fillData() {
        BigDecimal bigDecimal = new BigDecimal(0);
        this.income = this.income == null ? bigDecimal : this.income;
        this.incomeCount = this.incomeCount == null ? 0L : this.incomeCount;
        this.refund = this.refund == null ? bigDecimal : this.refund;
        this.refundCount = this.refundCount == null ? 0L : this.refundCount;
        this.manualDepositIncomeCount = Optional.ofNullable(this.manualDepositIncomeCount).orElse(0L);
        this.manualDepositIncomeSum = Optional.ofNullable(this.manualDepositIncomeSum).orElse(bigDecimal);
        this.manualDepositExpenditureCount = Optional.ofNullable(this.manualDepositExpenditureCount).orElse(0L);
        this.manualDepositExpenditureSum = Optional.ofNullable(this.manualDepositExpenditureSum).orElse(bigDecimal);
        this.termStart = this.termStart == null ? bigDecimal : this.termStart;
        this.termEnd = this.termEnd == null ? bigDecimal : this.termEnd;
    }
}
